package com.ivt.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;
import com.ivt.utils.enums.Sign;

@Entity
@Table(name = "sc_attendance")
public class Attendance implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "attendance_id", unique = true, nullable = false)
	private Long attendanceId;

	// 地点
	@Column(name = "address", length = 200, nullable = false)
	private String address;

	// 坐标
	@Column(name = "coordinate", length = 500, nullable = false)
	private String coordinate;

	@Column(name = "sign_time")
	private Date signTime;

	@Column(name = "courses_time")
	private Date coursesTime;

	private Sign sign;

	@Column(name = "teacher_id")
	private Long teacherId;

	@ManyToOne(targetEntity = Courses.class)
	@JoinColumn(name = "courses_id", updatable = false, nullable = true)
	private Courses courses;

	@ManyToOne(targetEntity = Student.class)
	@JoinColumn(name = "student_id", updatable = false,nullable = true)
	private Student student;

	public Long getAttendanceId() {
		return attendanceId;
	}

	public void setAttendanceId(Long attendanceId) {
		this.attendanceId = attendanceId;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCoordinate() {
		return coordinate;
	}

	public void setCoordinate(String coordinate) {
		this.coordinate = coordinate;
	}

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	public Date getSignTime() {
		return signTime;
	}

	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public Date getCoursesTime() {
		return coursesTime;
	}

	public void setCoursesTime(Date coursesTime) {
		this.coursesTime = coursesTime;
	}

	public Courses getCourses() {
		return courses;
	}

	public void setCourses(Courses courses) {
		this.courses = courses;
	}

	public Sign getSign() {
		return sign;
	}

	public void setSign(Sign sign) {
		this.sign = sign;
	}

	public Long getTeacherId() {
		return teacherId;
	}

	public void setTeacherId(Long teacherId) {
		this.teacherId = teacherId;
	}

}
